home *** CD-ROM | disk | FTP | other *** search
- on recordPuzzleInfo
- set solvedField to new(#field)
- set the name of solvedField to "solvedLocs"
- put EMPTY into field "solvedLocs"
- set typeField to new(#field)
- set the name of typeField to "pieceTypes"
- put EMPTY into field "pieceTypes"
- set typeSolvedField to new(#field)
- set the name of typeSolvedField to "typeSolvedList"
- put EMPTY into field "typeSolvedList"
- set fixedField to new(#field)
- set the name of fixedField to "fixedPieces"
- put EMPTY into field "fixedPieces"
- set boardField to new(#field)
- set the name of boardField to "boardRect"
- set savedFrame to the frame
- go(label("board"))
- set boardRect to the rect of sprite 1
- put boardRect into field "boardRect"
- go(label("fixed"))
- set fixedList to []
- repeat with i = 48 down to 1
- if the memberNum of sprite i <> 0 then
- set thisRect to the rect of sprite i
- set thisType to value("#" & word 1 of the name of the member of sprite i)
- if intersect(thisRect, boardRect) = thisRect then
- add(fixedList, [thisRect, thisType])
- end if
- end if
- end repeat
- put string(fixedList) into field "fixedPieces"
- go(label("solved"))
- set solvedList to [:]
- set pieceTypes to [:]
- set allSprites to []
- repeat with i = 48 down to 1
- if the memberNum of sprite i <> 0 then
- set thisRect to the rect of sprite i
- if intersect(thisRect, boardRect) = thisRect then
- set addThisOne to 1
- repeat with j in fixedList
- if i = j then
- set addThisOne to 0
- end if
- end repeat
- if addThisOne then
- addProp(solvedList, i, the loc of sprite i)
- addProp(pieceTypes, i, value("#" & word 1 of the name of the member of sprite i))
- add(allSprites, i)
- end if
- end if
- end if
- end repeat
- put string(solvedList) into field "solvedLocs"
- put string(pieceTypes) into field "pieceTypes"
- set allTypes to []
- set typeSymbols to []
- set typeSolvedList to [:]
- repeat with i in pieceTypes
- set addThisType to 1
- repeat with j in typeSymbols
- if i = j then
- set addThisType to 0
- end if
- exit repeat
- end repeat
- if addThisType then
- add(allTypes, i)
- addProp(typeSolvedList, i, [])
- end if
- end repeat
- repeat with i in allSprites
- set thisType to getProp(pieceTypes, i)
- set thisList to getProp(typeSolvedList, thisType)
- add(thisList, the loc of sprite i)
- end repeat
- put string(typeSolvedList) into field "typeSolvedList"
- go(savedFrame)
- end
-